from api.basic_api import BaseSellerApi


class AddGoodsApi(BaseSellerApi):
    def __init__(self):
        super().__init__()
        self.url=f'{self.host}/seller/goods'
        self.method='post'
        self.json={
                "brand_id": 11,
                "category_id": 10,
                "category_name": "",
                "goods_name": "榛果巧克力5",
                "sn": "2330",
                "price": "15.8",
                "mktprice": "18.9",
                "cost": "10",
                "weight": "20",
                "goods_gallery_list": [{
                    "img_id": -1,
                    "original": "http://59.36.173.55:7000/statics/attachment/goods/2024/11/15/17/35125891.jpeg",
                    "sort": 0
                }],
                "quantity": 1000,
                "goods_transfee_charge": 1,
                "has_changed": 0,
                "market_enable": 1,
                "template_id": 0,
                "exchange": {
                    "category_id": "",
                    "enable_exchange": 0,
                    "exchange_money": 0,
                    "exchange_point": 0
                },
                "shop_cat_id": 0,
                "meta_description": "",
                "meta_keywords": "",
                "page_title": "",
                "goods_params_list": [{
                    "id": '',
                    "goods_id": '',
                    "param_id": 144,
                    "param_name": "生产许可证编号",
                    "param_value": "",
                    "param_type": 1,
                    "options": "",
                    "required": 0,
                    "group_id": 17,
                    "is_index": 0,
                    "option_list": [""]
                }, {
                    "id": '',
                    "goods_id": '',
                    "param_id": 145,
                    "param_name": "产品标准号",
                    "param_value": "",
                    "param_type": 1,
                    "options": "",
                    "required": 0,
                    "group_id": 17,
                    "is_index": 0,
                    "option_list": [""]
                }, {
                    "id": '',
                    "goods_id": '',
                    "param_id": 146,
                    "param_name": "厂名",
                    "param_value": "",
                    "param_type": 1,
                    "options": "",
                    "required": 0,
                    "group_id": 17,
                    "is_index": 0,
                    "option_list": [""]
                }, {
                    "id": '',
                    "goods_id": '',
                    "param_id": 147,
                    "param_name": "厂址",
                    "param_value": "",
                    "param_type": 1,
                    "options": "",
                    "required": 0,
                    "group_id": 17,
                    "is_index": 0,
                    "option_list": [""]
                }, {
                    "id": '',
                    "goods_id": '',
                    "param_id": 148,
                    "param_name": "厂家联系方式",
                    "param_value": "",
                    "param_type": 1,
                    "options": "",
                    "required": 0,
                    "group_id": 17,
                    "is_index": 0,
                    "option_list": [""]
                }, {
                    "id": '',
                    "goods_id": '',
                    "param_id": 149,
                    "param_name": "配料表",
                    "param_value": "",
                    "param_type": 1,
                    "options": "",
                    "required": 0,
                    "group_id": 17,
                    "is_index": 0,
                    "option_list": [""]
                }, {
                    "id": '',
                    "goods_id": '',
                    "param_id": 150,
                    "param_name": "储藏方式",
                    "param_value": "",
                    "param_type": 1,
                    "options": "",
                    "required": 0,
                    "group_id": 17,
                    "is_index": 0,
                    "option_list": [""]
                }, {
                    "id": '',
                    "goods_id": '',
                    "param_id": 151,
                    "param_name": "保质期",
                    "param_value": "",
                    "param_type": 2,
                    "options": "2年",
                    "required": 0,
                    "group_id": 17,
                    "is_index": 0,
                    "option_list": ["2年"]
                }, {
                    "id": '',
                    "goods_id": '',
                    "param_id": 152,
                    "param_name": "净含量",
                    "param_value": "",
                    "param_type": 1,
                    "options": "",
                    "required": 0,
                    "group_id": 17,
                    "is_index": 0,
                    "option_list": [""]
                }, {
                    "id": '',
                    "goods_id": '',
                    "param_id": 153,
                    "param_name": "品牌",
                    "param_value": "",
                    "param_type": 1,
                    "options": "",
                    "required": 0,
                    "group_id": 17,
                    "is_index": 0,
                    "option_list": [""]
                }],
                "sku_list": [],
                "intro": ""
        }
class ModifyGoodsApi(BaseSellerApi):
    def __init__(self,goods_id):
        super().__init__()
        self.url=f'{self.host}/seller/goods/{goods_id}'
        self.method='put'
        self.json = {
            "brand_id": 11,
            "category_id": 10,
            "category_name": "",
            "goods_name": "榛果巧克力",
            "sn": "233",
            "price": "15.8",
            "mktprice": "18.9",
            "cost": "10",
            "weight": "20",
            "goods_gallery_list": [{
                "img_id": -1,
                "original": "http://59.36.173.55:7000/statics/attachment/goods/2024/11/15/17/35125891.jpeg",
                "sort": 0
            }],
            "quantity": 1000,
            "goods_transfee_charge": 1,
            "has_changed": 0,
            "market_enable": 1,
            "template_id": 0,
            "exchange": {
                "category_id": "",
                "enable_exchange": 0,
                "exchange_money": 0,
                "exchange_point": 0
            },
            "shop_cat_id": 0,
            "meta_description": "",
            "meta_keywords": "",
            "page_title": "",
            "goods_params_list": [{
                "id": '',
                "goods_id": '',
                "param_id": 144,
                "param_name": "生产许可证编号",
                "param_value": "",
                "param_type": 1,
                "options": "",
                "required": 0,
                "group_id": 17,
                "is_index": 0,
                "option_list": [""]
            }, {
                "id": '',
                "goods_id": '',
                "param_id": 145,
                "param_name": "产品标准号",
                "param_value": "",
                "param_type": 1,
                "options": "",
                "required": 0,
                "group_id": 17,
                "is_index": 0,
                "option_list": [""]
            }, {
                "id": '',
                "goods_id": '',
                "param_id": 146,
                "param_name": "厂名",
                "param_value": "",
                "param_type": 1,
                "options": "",
                "required": 0,
                "group_id": 17,
                "is_index": 0,
                "option_list": [""]
            }, {
                "id": '',
                "goods_id": '',
                "param_id": 147,
                "param_name": "厂址",
                "param_value": "",
                "param_type": 1,
                "options": "",
                "required": 0,
                "group_id": 17,
                "is_index": 0,
                "option_list": [""]
            }, {
                "id": '',
                "goods_id": '',
                "param_id": 148,
                "param_name": "厂家联系方式",
                "param_value": "",
                "param_type": 1,
                "options": "",
                "required": 0,
                "group_id": 17,
                "is_index": 0,
                "option_list": [""]
            }, {
                "id": '',
                "goods_id": '',
                "param_id": 149,
                "param_name": "配料表",
                "param_value": "",
                "param_type": 1,
                "options": "",
                "required": 0,
                "group_id": 17,
                "is_index": 0,
                "option_list": [""]
            }, {
                "id": '',
                "goods_id": '',
                "param_id": 150,
                "param_name": "储藏方式",
                "param_value": "",
                "param_type": 1,
                "options": "",
                "required": 0,
                "group_id": 17,
                "is_index": 0,
                "option_list": [""]
            }, {
                "id": '',
                "goods_id": '',
                "param_id": 151,
                "param_name": "保质期",
                "param_value": "",
                "param_type": 2,
                "options": "2年",
                "required": 0,
                "group_id": 17,
                "is_index": 0,
                "option_list": ["2年"]
            }, {
                "id": '',
                "goods_id": '',
                "param_id": 152,
                "param_name": "净含量",
                "param_value": "",
                "param_type": 1,
                "options": "",
                "required": 0,
                "group_id": 17,
                "is_index": 0,
                "option_list": [""]
            }, {
                "id": '',
                "goods_id": '',
                "param_id": 153,
                "param_name": "品牌",
                "param_value": "",
                "param_type": 1,
                "options": "",
                "required": 0,
                "group_id": 17,
                "is_index": 0,
                "option_list": [""]
            }],
            "sku_list": [],
            "intro": ""
        }

class UnderGoodsApi(BaseSellerApi):

    def __init__(self,goods_ids:list):
        super().__init__()
        goods_ids = [str(x) for x in goods_ids]
        goods_ids = ','.join(goods_ids)
        self.url = f'{self.host}/seller/goods/{goods_ids}/under'
        self.method = 'put'

class RecycleGoodsApi(BaseSellerApi):

    def __init__(self,goods_ids:list):
        super().__init__()
        goods_ids = [str(x) for x in goods_ids]
        goods_ids = ','.join(goods_ids)
        self.url = f'{self.host}/seller/goods/{goods_ids}/recycle'
        self.method = 'put'

class DeleteGoodsApi(BaseSellerApi):

    def __init__(self,goods_ids:list):
        super().__init__()
        goods_ids = [str(x) for x in goods_ids]
        goods_ids = ','.join(goods_ids)
        self.url = f'{self.host}/seller/goods/{goods_ids}'
        self.method = 'delete'
class GetGoodsSkuInfoApi(BaseSellerApi):

    def __init__(self,goods_id):
        super().__init__()
        self.url = f'{self.host}/seller/goods/{goods_id}/skus'
        self.method = 'get'


if __name__ == '__main__':
     s=[1,2,3]
    # #怎么把s这个列表变成“1,2,3"这样的字符串
    # s=[str(x) for x in s]
    # print(s)
    # s=",".join(s)
    # print(f'sll{s}')